<template>
  <div class="gradient-header text-center mb-8 p-5 text-white rounded-xl shadow-lg">
    <div class="flex items-center justify-center gap-5 flex-wrap">
      <div class="text-left header-text-responsive">
        <h1 class="m-0 mb-2.5 text-3xl">🔍 预测结果查看器</h1>
        <p class="m-0 text-base opacity-90">上传图片创建任务或查看现有任务的预测结果</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AppHeader',
  data() {
    return {
      baseUrl: 'http://k396a3ad.natappfree.cc',
      logoUrl: ''
    }
  },
  created() {
    this.logoUrl = this.replaceImageUrl('http://k396a3ad.natappfree.cc/public/logo.png')
  },
  methods: {
    replaceImageUrl(url) {
      if (!url || !this.baseUrl) return url
      return url.replace(/https?:\/\/([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+|minio:[0-9]+)/g, this.baseUrl)
    },
    hideLogoOnError(event) {
      event.target.style.display = 'none'
    }
  }
}
</script>

<style scoped>
@media (max-width: 768px) {
  .header-text-responsive {
    text-align: center;
  }
  img {
    height: 50px;
  }
}
</style>

